package org.linloong;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.net.InetAddress;
import java.net.UnknownHostException;

@EnableConfigurationProperties
@SpringBootApplication
@MapperScan("org.linloong.modules.**.mapper")
@Slf4j
@EnableScheduling
@EnableAsync
public class EucalyptusApplication {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext application = SpringApplication.run(EucalyptusApplication.class, args);
        Environment env = application.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        String path = env.getProperty("server.servlet.context-path");
        log.info("\n----------------------------------------------------------\n\t" +
                "Application is running! \n\t" +
                "Access URLs: \t http://" + ip + ":" + port + path + "\n\t" +
                "Swagger文档: \t http://" + ip + ":" + port + path + "/doc.html\n" +
                "----------------------------------------------------------");
    }
}
